#ifndef DOWNLOAD_THREAD_H
#define DOWNLOAD_THREAD_H



#include<wx/thread.h>
#include "libvdnEvent.h"
#include <string.h>



#ifdef _cplusplus
extern "C"
	{
#endif 


#include "curl/curl.h"


#ifdef _cplusplus
}
#endif




/****
//enumerate the services that are available
*/
enum libvdn_SERVICE{
	SER_YOUTUBE
	};



/****
//the struct that we will store the data in to write 
*/
struct libvdn_vidFile{

	const char *filename;
	FILE *stream;
	};

//functions for curl

		static size_t libvdn_writer(void *buffer, size_t size, size_t nmemb, void *stream);

		int progress_callback(libvdnEvent* evt,double t,double d,double ultotal,double ulnow);

		int libvdn_DownloadVideo(libvdn_SERVICE service, const char* url, const char* filename, libvdnEvent& evt, wxWindow* par);





class DownloadThread : public wxThread
	{
	public:
	DownloadThread(wxWindow *pParent,  wxString str_url,  wxString str_file);
	virtual ~DownloadThread();
	
	public:
	virtual void *Entry();
	virtual void OnExit();

	public:
	

	//function: void | CancelDownload
	//lets the user/program cancel the download
		void CancelDownload();

	private:
		
		 wxString wstr_url;
		 wxString wstr_fname;
		wxWindow *t_pParent;
		bool downloadDone;

	private:
		void DownloadFile();


		


	};




#endif

